package hibernate;

/**
 *
 * @author Igor Kovb
 */
public class RequestStatus extends DBEntity {

    private String description;

    RequestStatus() {
    }

    private RequestStatus(int id, String description) {
        this.setId(id);
        this.setDescription(description);
    }
    
    private final static RequestStatus IN_PROGRESS = new RequestStatus (1, "In progress");
    private final static RequestStatus COMPLETED = new RequestStatus(2, "Completed");
    private final static RequestStatus REJECTED = new RequestStatus(3, "Rejected");

    /**
     * @return the in progress RequestStatus object
     */
    public static RequestStatus GET_IN_PROGRESS_STATUS() {
        RequestStatus res = new RequestStatus(IN_PROGRESS.getId(), IN_PROGRESS.getDescription());
        return res;
    }

    /**
     * @return the RequestStatus object
     */
    public static RequestStatus GET_COMPLETED_STATUS() {
        RequestStatus res = new RequestStatus(COMPLETED.getId(), COMPLETED.getDescription());
        return res;
    }

    /**
     * @return the RequestStatus object
     */
    public static RequestStatus GET_REJECTED_STATUS() {
        RequestStatus res = new RequestStatus(REJECTED.getId(), REJECTED.getDescription());
        return res;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }
    
    public boolean equals(RequestStatus rs){
        boolean res = false;
        if (this.getId() == rs.getId()&&
            this.getDescription().equals(rs.getDescription())){
            res = true;
        }
        return res;        
    }
    
    @Override
    public boolean equals(Object o) {
        boolean res = false;
        if (o instanceof RequestStatus) {
            RequestStatus p = (RequestStatus) o;
            res = this.equals(p);
        }
        return res;
    }
}
